
Imports System.Data.SqlClient

Namespace PresentationLayer
    Public Class FrmBuscaDestino

        Private Sub FrmBuscaDestino_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

            StringComando = "SELECT Cliente.IDCliente, Cliente.Nombre, Cliente.Domicilio, Cliente.CUIT, Localidad.Nombre AS Localidad, Localidad.CodigoPostal "
            StringComando += "FROM Cliente INNER JOIN Localidad ON Cliente.Localidad = Localidad.IDLocalidad"

            Dim Conecta As New SqlConnection(StringConecta)
            Conecta.Open()
            Comando = New SqlCommand(StringComando, Conecta)


            Adapter = New SqlDataAdapter(StringComando, Conecta)
            Ds = New DataSet
            Adapter.Fill(Ds, "Clientes")

            DataGridViewClientes.DataSource = Ds.Tables("Clientes")

            Conecta.Close()
            Conecta.Dispose()

        End Sub

        Private Sub DataGridViewClientes_DoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridViewClientes.CellContentClick

            IdDestino = Ds.Tables("Clientes").Rows(e.RowIndex).Item(0)
            NombreDestino = Ds.Tables("Clientes").Rows(e.RowIndex).Item(1)
            DomicilioDestino = (Ds.Tables("Clientes").Rows(e.RowIndex).Item(2))
            CUITDestino = (Ds.Tables("Clientes").Rows(e.RowIndex).Item(3))
            LocalidadDestino = Ds.Tables("Clientes").Rows(e.RowIndex).Item(4)
            CPDestino = Ds.Tables("Clientes").Rows(e.RowIndex).Item(5)




            Me.Close()

        End Sub

        Private Sub DataGridViewClientes_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridViewClientes.CellContentClick

        End Sub
    End Class
End Namespace